<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="周历" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doNew(){
		var url="/base/EstablishmentCommunicateNew.ihtm";
		ShowIframe("日程",url,980,440,"refreshWin()",900,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location.reload(true);
		}
	}
	function doCancel(){
		window.close();
	}
	function DoubleClick(){
		
	}
	function doSearch(){
		var year=document.getElementById("year").value;
		var month=document.getElementById("month").value;
		var currentDate=year+"-"+month+"-01";
		var stafferId=document.getElementById("staffer_id").value;
		window.location="EstablishmentCommunicateCalendar.ihtm?type=WEEK&current_date="+currentDate+"&staffer_id="+stafferId;
	}
	function goAnthor(action){
		window.location="EstablishmentCommunicateCalendar.ihtm?type=WEEK&current_date=${startDate}&staffer_id=${stafferId}&action="+action;
	}
	function showComm(id){
		var url="/base/EstablishmentCommunicateEdit.ihtm?id="+id;
		ShowIframe("日程",url,980,440,"refreshWin()",900,600);
	}
	function changeMode(type){
		window.location="EstablishmentCommunicateCalendar.ihtm?type="+type;
	}
	function showToday(){
		var stafferId=document.getElementById("staffer_id").value;
		window.location="EstablishmentCommunicateCalendar.ihtm?type=WEEK&staffer_id=${stafferId}";
	}
	function doInit(){
		if(window.screen.availWidth>900){
			var w=window.screen.availWidth*0.98;
			document.getElementById("mainDiv").style.width=(w-60)+"px";
		}
	}
	function doDownload(){
		window.location="/base/EstablishmentCommunicateCalendar.ihtm?content_type=EXCEL&type=WEEK&current_date=${startDate}&staffer_id=${stafferId}";
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet modal-dialog" style="text-align:center" onload="doInit();">
<div class="sheet-main" style="width:855px;text-align:left;margin:auto" id="mainDiv">
	<div class="sheet-top">
		<div class="content calendar">
		  <h2>周历</h2>
		  <p>管理自己以及下属的工作计划与日志</p>
		</div>
	</div>
	<div class="sheet-list">
		<div class="search-business calendar">
		
			<%@include file="../inc/AlertMsg.jsp"%>
		
			<div class="calendar-info">
				<div class="calendar-search">
					<select id="year" name="year">
						<c:forEach var="item" begin="2009" step="1" end="${lastYear}" varStatus="i"><option value="${lastYear-i.index}" <c:if test="${lastYear-i.index==year}">selected</c:if>>${lastYear-i.index}</option></c:forEach>
					</select>
					年
					<select id="month" name="month">
						<c:forEach var="item" begin="1" step="1" end="12" varStatus="i"><option value="${item}" <c:if test="${item==month}">selected</c:if>>${item}</option></c:forEach>
					</select>
					月
					<select name="staffer_id" id="staffer_id">
						<option value="${ub.staffer.id}">自己</option>
						<c:forEach var="item" items="${stafferList}">
							<option value="${item.id}" <c:if test="${item.id==stafferId}">selected</c:if>>${item.stafferName}</option>
						</c:forEach>
					</select>
					<input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();">
					<input type="button" class="buttom search-add" value=" 新 增" onClick="doNew();">
					<input type="button" class="buttom  search-out" value=" 导 出" onClick="doDownload();"/>
				</div>
				<div class="calendar-info-main">
					<ul id="myTab1" class="calendar-tag" style="float:left">
						<li onclick="changeMode('DATE');" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#2B6EAF'">日</li>
						<li class="active" onclick="changeMode('WEEK');" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#2B6EAF'">周</li>
						<li onclick="changeMode('MONTH');" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#2B6EAF'">月</li>
					</ul>
					<div id="myTab1_Content1">
						<div class="today">
							<a href="javascript:goAnthor('PREVIEW');" class="last"><c></a><a href="javascript:goAnthor('NEXT');" class="next"><c></a>
							<input name="今天" type="button" value="今天" class="buttom buttom-b" onClick="showToday();" />
							<span>${startDate} 至 ${endDate}</span>
						</div>
						<table style="width:100%" class="monthly zhou" id="mainTbl">
							<tr><th>星期日</th><th>星期一</th><th>星期二</th><th>星期三</th><th>星期四</th><th>星期五</th><th>星期六</th></tr>
							<tr>
								<c:forEach var="wItem" items="${list}" varStatus="i">
								<td <c:if test="${fn:length(wItem[2])>0}">class="active"</c:if>>
									<c:forEach var="item" items="${wItem[2]}" varStatus="i">
										<c:if test="${item.communicate.commType=='LOG'}"><c:set var="className" value="comm-log" /></c:if><c:if test="${item.communicate.commType=='PLAN'}"><c:set var="className" value="comm-plan" /><c:if test="${item.communicate.smsRemind=='Y'}"><c:set var="className" value="comm-plan-sms" /></c:if><c:if test="${item.communicate.completed=='Y'}"><c:set var="className" value="ok" /></c:if></c:if>
										<p class="${className}"><a href="javascript:showComm(${item.communicate.id});"><c:if test="${item.communicate.estId!=0}">${item.estName}：</c:if>${item.communicate.title}</a></p>
									</c:forEach>
								</td>
								</c:forEach>
							</tr>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

</body>
</html>
